****************************************
* Table B11: Hurricane Proximity and Democrat Vote Share in Presidential Elections
******************************************

preserve
use "$input/pres-hur", clear
xtset group

qui gen treatment = treatment500
qui xtreg demopresshare_total treatment500 i.year  , fe cl(group)
qui gen coef=_b[treatment]
qui sum demopresshare_total if treatment==0 & e(sample)
qui gen cmean = r(mean)
qui gen percent = coef/cmean * 100 // i multiply with 100 because cmean and coef are between 0-1 and not 0-100.
local mean1 = round(cmean, 0.001)
local percent1 = round(percent, 0.001) 
outreg2 using "$output/tabb11.doc", addtext( "Control Mean =", "`mean1'", "Effect  =", "`percent1'",) replace dec(3) 
drop cmean coef percent treatment
local foo 




qui gen treatment = treatment400
qui xtreg demopresshare_total treatment400 i.year  , fe cl(group)
qui gen coef=_b[treatment]
qui sum demopresshare_total if treatment==0 & e(sample)
qui gen cmean = r(mean)
qui gen percent = coef/cmean * 100 // i multiply with 100 because cmean and coef are between 0-1 and not 0-100.
local mean1 = round(cmean, 0.001)
local percent1 = round(percent, 0.001) 
outreg2 using "$output/tabb11.doc", addtext( "Control Mean =", "`mean1'", "Effect  =", "`percent1'",) append dec(3) 
drop cmean coef percent treatment
local foo 


qui gen treatment = treatment300
qui xtreg demopresshare_total treatment300 i.year  , fe cl(group)
qui gen coef=_b[treatment]
qui sum demopresshare_total if treatment==0 & e(sample)
qui gen cmean = r(mean)
qui gen percent = coef/cmean * 100 // i multiply with 100 because cmean and coef are between 0-1 and not 0-100.
local mean1 = round(cmean, 0.001)
local percent1 = round(percent, 0.001) 
outreg2 using "$output/tabb11.doc", addtext( "Control Mean =", "`mean1'", "Effect  =", "`percent1'",) append dec(3) 
drop cmean coef percent treatment
local foo 

qui gen treatment = treatment200
qui xtreg demopresshare_total treatment200 i.year  , fe cl(group)
qui gen coef=_b[treatment]
qui sum demopresshare_total if treatment==0 & e(sample)
qui gen cmean = r(mean)
qui gen percent = coef/cmean * 100 // i multiply with 100 because cmean and coef are between 0-1 and not 0-100.
local mean1 = round(cmean, 0.001)
local percent1 = round(percent, 0.001) 
outreg2 using "$output/tabb11.doc", addtext( "Control Mean =", "`mean1'", "Effect  =", "`percent1'",) append dec(3) 
drop cmean coef percent treatment
local foo 

qui gen treatment = treatment100
qui xtreg demopresshare_total treatment100 i.year  , fe cl(group)
qui gen coef=_b[treatment]
qui sum demopresshare_total if treatment==0 & e(sample)
qui gen cmean = r(mean)
qui gen percent = coef/cmean * 100 // i multiply with 100 because cmean and coef are between 0-1 and not 0-100.
local mean1 = round(cmean, 0.001)
local percent1 = round(percent, 0.001) 
outreg2 using "$output/tabb11.doc", addtext( "Control Mean =", "`mean1'", "Effect  =", "`percent1'",) append dec(3) 
drop cmean coef percent treatment
local foo 

qui gen treatment = treatment50
qui xtreg demopresshare_total treatment50 i.year  , fe cl(group)
qui gen coef=_b[treatment]
qui sum demopresshare_total if treatment==0 & e(sample)
qui gen cmean = r(mean)
qui gen percent = coef/cmean * 100 // i multiply with 100 because cmean and coef are between 0-1 and not 0-100.
local mean1 = round(cmean, 0.001)
local percent1 = round(percent, 0.001) 
outreg2 using "$output/tabb11.doc", addtext( "Control Mean =", "`mean1'", "Effect  =", "`percent1'",)  dec(3)  append tex
drop cmean coef percent treatment
local foo 
restore
